package com.sc.portal.service.impl;

import com.sc.common.pojo.CommonResult;
import com.sc.pojo.TbItem;
import com.sc.portal.service.ItemService;
import com.sc.portal.service.StaticPageService;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @auther sc
 * @Date 2017/10/27
 */
public class StaticPageServiceImpl implements StaticPageService {
    @Autowired
    private ItemService itemService;
    @Autowired
    private FreeMarkerConfigurer  freemarkerConfig;

    @Override
    public CommonResult genItemHtml(Long itemID) throws IOException {
        TbItem item = itemService.getItemById(itemID);
        String itemdesc = itemService.getItemDesc(itemID);
        String itemParam = itemService.getdetail(itemID);
        Configuration configuration = freemarkerConfig.getConfiguration();
        Template template = configuration.getTemplate("item.ftl");
        Map root = new HashMap();


        return null;
    }
}
